String.prototype.uword = function()
{
  var words = this.split(/[\s]+/);
  var uw = '';
  for(var w=0; w <words.length; w++) {
    uw += words[w].substr(0,1).toUpperCase();
    uw += words[w].substr(1).toLowerCase()+' ';
  }
  
  return uw;
}

Function.prototype.inherits = function(parent) {
    var d = {}, p = (this.prototype = new parent());
    this.prototype.uber = function(name, p1, p2, p3) {
        if (!(name in d)) {
            d[name] = 0;
        }        
        var f, r, t = d[name], v = parent.prototype;
        if (t) {
            while (t) {
                v = v.constructor.prototype;
                t -= 1;
            }
            f = v[name];
        } else {
            f = p[name];
            if (f == this[name]) {
                f = v[name];
            }
        }
        d[name] += 1;
        r = f.apply(this, Array.prototype.slice.apply(arguments, [1]));
        d[name] -= 1;
        return r;
    }
    return this;
}

WebService = function() {}

WebService.prototype.setTarget = function(targ)
{
  this.target = document.getElementById(targ);
}

WebService.prototype.error = function(status, target, sText)
{
  if(!target) var target = this.target;
  target.innerHTML = sText;
}

WebService.prototype.JSONcall = function(src,id)
{
  var js =  document.getElementById(id);
  if(js) document.getElementsByTagName('body')[0].removeChild(js);
  js = document.createElement('script');
  js.type = 'text/javascript';
  js.src = src;
  if(id) js.id = id;
  return document.getElementsByTagName('body')[0].appendChild(js);

}

WebService.prototype.checkResponse = function(httpObj)
{
  if(httpObj.responseXML.getElementsByTagName('proxyerror')[0]){
    this.error();
    return false
  }
  return true;
}

WebService.prototype.serialize = function(oFrom)
{
  var aTemp = [];
  for (var i in oFrom)
  {
    aTemp.push(encodeURIComponent(i) +'='+ encodeURIComponent(oFrom[i]));
  }
  return aTemp.join('&');
}

WebService.prototype.addslashes = function (str) {
  str=str.replace(/\'/g,'\\\'');
  str=str.replace(/"/g,'%22');
  str=str.replace(/\\/g,'\\');
  return str;
}
